import { defineStore } from 'pinia';
import { ref } from 'vue';
import { seekerTabbarList } from '@/utils/constant';

// 定义 Store
export const useSeekerTabbarStore = defineStore('tabbar', () => {
	// 激活的tab页
	const activeTab = ref<string | number>('home');

	// 保存激活的tab页
	const setActiveTab = (val: UviewTabbarItem['name']) => {
		activeTab.value = val;
	};

	// 当前tabbar的列表
	const tabbarList = ref<UviewTabbarItem[]>(seekerTabbarList);

	// 重新设置tabbar的列表
	const setTabbarList = (list: UviewTabbarItem[]) => {
		tabbarList.value = list;
	};

	return {
		activeTab,
		setActiveTab,
		tabbarList,
		setTabbarList
	};
});
